package com.baseweb.webadmin.core.model.mapper;

import com.baseweb.webadmin.core.model.pojo.ByLevel;
import com.baseweb.webadmin.core.model.pojo.ByLevelExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ByLevelMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_level
     *
     * @mbggenerated Thu Feb 09 01:07:15 CST 2017
     */
    int countByExample(ByLevelExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_level
     *
     * @mbggenerated Thu Feb 09 01:07:15 CST 2017
     */
    int deleteByExample(ByLevelExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_level
     *
     * @mbggenerated Thu Feb 09 01:07:15 CST 2017
     */
    @Delete({
        "delete from by_level",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_level
     *
     * @mbggenerated Thu Feb 09 01:07:15 CST 2017
     */
    @Insert({
        "insert into by_level (start_value, end_value, ",
        "level_type, level_icon, ",
        "level_name, create_time, ",
        "update_time)",
        "values (#{startValue,jdbcType=INTEGER}, #{endValue,jdbcType=INTEGER}, ",
        "#{levelType,jdbcType=INTEGER}, #{levelIcon,jdbcType=VARCHAR}, ",
        "#{levelName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}, ",
        "#{updateTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(ByLevel record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_level
     *
     * @mbggenerated Thu Feb 09 01:07:15 CST 2017
     */
    int insertSelective(ByLevel record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_level
     *
     * @mbggenerated Thu Feb 09 01:07:15 CST 2017
     */
    List<ByLevel> selectByExample(ByLevelExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_level
     *
     * @mbggenerated Thu Feb 09 01:07:15 CST 2017
     */
    @Select({
        "select",
        "id, start_value, end_value, level_type, level_icon, level_name, create_time, ",
        "update_time",
        "from by_level",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ByLevel selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_level
     *
     * @mbggenerated Thu Feb 09 01:07:15 CST 2017
     */
    int updateByExampleSelective(@Param("record") ByLevel record, @Param("example") ByLevelExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_level
     *
     * @mbggenerated Thu Feb 09 01:07:15 CST 2017
     */
    int updateByExample(@Param("record") ByLevel record, @Param("example") ByLevelExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_level
     *
     * @mbggenerated Thu Feb 09 01:07:15 CST 2017
     */
    int updateByPrimaryKeySelective(ByLevel record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_level
     *
     * @mbggenerated Thu Feb 09 01:07:15 CST 2017
     */
    @Update({
        "update by_level",
        "set start_value = #{startValue,jdbcType=INTEGER},",
          "end_value = #{endValue,jdbcType=INTEGER},",
          "level_type = #{levelType,jdbcType=INTEGER},",
          "level_icon = #{levelIcon,jdbcType=VARCHAR},",
          "level_name = #{levelName,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ByLevel record);
}